﻿//-----------------------------------------------------------------------
// <copyright file="GroupBoxDelegates.cs" company="MSCRMTools">
//     Copyright © MSCRMTools. All rights reserved.
// </copyright>
// <author>tanguy92</author>
// <date>21/02/2011</date>
// <codeplexurl>http://searchablepropertyupdater.codeplex.com</codeplexurl>
// <summary>no summary</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Tanguy.WinForm.Utilities.DelegatesHelpers
{
    class GroupBoxDelegates
    {
        public static void SetEnableState(GroupBox gb, bool enabled)
        {
            MethodInvoker mi = delegate
            {
                gb.Enabled = enabled;
            };

            if (gb.InvokeRequired)
            {
                gb.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
    }
}